module.exports=function(o){
	var index = o.index,tabTs = o.tabTs,tabCs = o.tabCs,toggle = o.toggle,defaultT,defaultC;
	return function(e){
		if(!toggle){//没有toggle
			console.log("no");
			if(this.className.indexOf("active") != -1) return false;
			for(var n=0;n<tabTs.length;n++){
				if(tabTs[n].className.indexOf("active") != -1) defaultT = tabTs[n];
				if(tabCs[n].className.indexOf(" show fade") != -1) defaultC = tabCs[n];
			}
			defaultT.className = defaultT.className.replace(" active","");
			this.className = this.className + " active";
			defaultC.className = 'tabc';
			tabCs[index].className = "tabc show fade";
		}else{//有toggle
			console.log("yes");
			if(this.className.indexOf("active") != -1){
				this.className = this.className.replace(" active","");
				tabCs[index].className = tabCs[index].className.replace(" fade","");
				setTimeout(function(){
					tabCs[index].className = tabCs[index].className.replace(" show","");
				},120);
			}else{
				for(var n=0;n<tabTs.length;n++){
					if(tabTs[n].className.indexOf("active") != -1) defaultT = tabTs[n];
					if(tabCs[n].className.indexOf("show fade") != -1) defaultC = tabCs[n];
				}
				if(defaultT) defaultT.className = defaultT.className.replace(" active","");
				this.className = this.className + " active";
				if(defaultC) defaultC.className = defaultC.className.replace(" fade","");
				setTimeout(function(){
					if(defaultC) defaultC.className = defaultC.className.replace(" show","");
					tabCs[index].className = tabCs[index].className + " show";
					setTimeout(function(){
						tabCs[index].className = tabCs[index].className + " fade";
					},10);
				},120);
			}
		}
	};
};